package com.ztewatch.wearcontacts.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.util.Log;

import com.ztewatch.wearcontacts.service.LoadGroupService;

public class BootReceiver extends BroadcastReceiver {
	private static final String TAG = "BootReceiver1";
	private Handler mHandler;
	private Context mContext;

	@Override
	public void onReceive(Context arg0, Intent arg1) {
		Log.e(TAG, "Contacts,BootReceiver");
		mContext = arg0;

		if (Intent.ACTION_BOOT_COMPLETED.equals(arg1.getAction())) {
			mHandler = new Handler() {
				@Override
				public void handleMessage(Message msg) {
					Log.e(TAG, "start group load service");
					Intent serviceintent_group = new Intent(mContext,
							LoadGroupService.class);
					mContext.startService(serviceintent_group);
				}
			};
			mHandler.sendMessageDelayed(mHandler.obtainMessage(), 3000);
		}
	}
}
